<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>团购王</title>
	<link rel="stylesheet" href="__PUBLIC__/bs/css/bootstrap.min.css">
	<link rel="stylesheet" href="../Public/css/index.css">
	<link rel="stylesheet" href="__PUBLIC__/Validform/style.css">
	<!-- 商品管理->添加商品：图片上传  开始-->
	<link href="__PUBLIC__/bs_fileinput/css/bootstrap.min.css" rel="stylesheet">
	<link href="__PUBLIC__/bs_fileinput/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
	<!-- 商品管理->添加商品：图片上传  结束-->
	<script src="__PUBLIC__/bs/js/jquery-1.7.2.min.js"></script>
	<!-- <script src="__PUBLIC__/bs/js/jquery.js"></script> -->
	<script src="__PUBLIC__/bs/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/Validform/Validform_min.js"></script>
	<script src="../Public/js/index.js"></script>
	<script src="../Public/js/common.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4&ak=MYmkCkYyS3ps8H8Lklij7uGbzQxWWIT3"></script><!-- 添加商铺，百度地图API -->
	<script type="text/javascript" src='../Public/js/shop.js'></script>
	<!-- 配置文件 -->
	<script type="text/javascript" src="./Ueditor/ueditor.config.js"></script>
	<!-- 编辑器源码文件 -->
	<script type="text/javascript" src="./Ueditor/ueditor.all.js"></script>

</head>
<body>
	<div class="container">
		<div class="header">
			<div class="logo"><img src="" alt=""></div>
			<div class="right">
			<div class="homemenu">
				<a href="">首页</a>
				<a href="">退出</a>
			</div>
			<div class="menuList">
				<a class="" href="javascript:void(0);">会员管理</a>
				
				<a class="Locality" href="<?php echo U('Locality/index');?>">地区管理</a>
				
				<a class="Category" href="<?php echo U('Category/index');?>">分类管理</a>
				
				<a class="Shop" href="<?php echo U('Shop/index');?>">商铺管理</a>
				
				<a class="Goods" href="<?php echo U('Goods/index');?>">商品管理</a>
				
				<a class="" href="javascript:void(0);">订单管理</a>
				
				<a class="Index" href="<?php echo U('Index/index');?>" style="background: #3B5A79;">站点概要</a>
			</div>

			</div>
		</div>
		<div class="box" >
			<div class="leftMenu">
				<div class="list-group ">
				  <a href="#" class="list-group-item active">
				    会员管理
				  </a>
				  <a href="#" class="list-group-item">查看会员</a>
				  <a href="#" class="list-group-item">添加会员</a>
				</div>
				<div class="list-group Locality">
				  <a href="#" class="list-group-item active">
				   地区管理
				  </a>
				  <a href="<?php echo U('Locality/index');?>" class="list-group-item">查看地区</a>
				  <a href="<?php echo U('Locality/add');?>" class="list-group-item">添加地区</a>
				</div>
				<div class="list-group Category">
				  <a href="#" class="list-group-item active">
				    分类管理
				  </a>
				  <a href="<?php echo U('Category/index');?>" class="list-group-item">查看分类</a>
				  <a href="<?php echo U('Category/add');?>" class="list-group-item">添加分类</a>
				</div>
				<div class="list-group Shop">
				  <a href="#" class="list-group-item active">
				   商铺管理
				  </a>
				  <a href="<?php echo U('Shop/index');?>" class="list-group-item">查看商铺</a>
				  <a href="<?php echo U('Shop/add');?>" class="list-group-item">添加商铺</a>
				</div>
				<div class="list-group Goods">
				  <a href="#" class="list-group-item active">
				   商品管理
				  </a>
				  <a href="<?php echo U('Goods/index');?>" class="list-group-item">查看商品</a>
				  <a href="<?php echo U('Goods/add');?>" class="list-group-item">添加商品</a>
				</div>
				<div class="list-group ">
				  <a href="#" class="list-group-item active">
				   订单管理
				  </a>
				  <a href="#" class="list-group-item">查看地区</a>
				  <a href="#" class="list-group-item">添加地区</a>
				</div>
				<div class="list-group Index">
				  <a href="#" class="list-group-item active" style="display: block;">
				   站点管理
				  </a>
				  <a href="#" class="list-group-item">查看地区</a>
				  <a href="#" class="list-group-item">添加地区</a>
				</div>
			</div>
			
<div class="rightBody">
	<span class='title'>编辑分类</span>
	<div id="content">
		<form  class='registerform' action="<?php echo U('Goods/edit_handle');?>" method="post" enctype="multipart/form-data">
			<table class='table table-striped table-bordered'>
				<thead>
					<tr>
						<th >名称</th>
						<th >值</th>
					</tr>
				</thead>
				<tbody>
						<tr>
							<td>商铺名称</td>
							<td>

									<select name="shopid" id="">
									<option value="0">请选择商铺</option>
									<?php if(is_array($shoprows)): $i = 0; $__LIST__ = $shoprows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$shoprow): $mod = ($i % 2 );++$i; if($row['shopid'] == $shoprow['shopid']): ?><option value="<?php echo ($shoprow['shopid']); ?>" selected><?php echo ($shoprow['shopname']); ?></option>
										<?php else: ?>
											<option value="<?php echo ($shoprow['shopid']); ?>"><?php echo ($shoprow['shopname']); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
									</select>
								
							</td>
						</tr>
					
						<tr>
							<td>分类名称</td>
							<td>
								<select name="cid" id="">
										<option value="0">请选择分类</option>
										<?php if(is_array($caterows)): $i = 0; $__LIST__ = $caterows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$caterow): $mod = ($i % 2 );++$i; if($row['cid'] == $caterow['cid']): ?><option value="<?php echo ($caterow['cid']); ?>" selected>|<?php echo ($caterow['html']); echo ($caterow['cname']); ?></option>
											<?php else: ?>
												<option value="<?php echo ($caterow['cid']); ?>">|<?php echo ($caterow['html']); echo ($caterow['cname']); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
								</select>
							</td>
						</tr>
						<tr>
							<td>所在地区</td>
							<td>
								<select name="lid" id="">
										<option value="0">请选择地区</option>
										<?php if(is_array($localrows)): $i = 0; $__LIST__ = $localrows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$localrow): $mod = ($i % 2 );++$i; if($row['lid'] == $localrow['lid']): ?><option value="<?php echo ($localrow['lid']); ?>" selected>|<?php echo ($localrow['html']); echo ($localrow['lname']); ?></option>
											<?php else: ?>
												<option value="<?php echo ($localrow['lid']); ?>">|<?php echo ($localrow['html']); echo ($localrow['lname']); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
								</select>
							</td>
						</tr>
					<tr>
						<td>商品主标题</td>
						<td>
							<input type="text" name="main_title" value="<?php echo ($row['main_title']); ?>" datatype="*1-35" errormsg="长度1-35位任意字符"  nullmsg="商品主标题不能为空" sucmsg="填写正确" />
							<span class="Validform_checktip" >不能超过35个字</span>
						</td>
					</tr>
					<tr>
						<td>商品副标题</td>
						<td>
							<input type="text" name="sub_title" value="<?php echo ($row['sub_title']); ?>" datatype="*1-100" errormsg="长度1-100位任意字符"  nullmsg="商品副标题不能为空" sucmsg="填写正确"/>
							<span class="Validform_checktip" >不能超过100个字</span>
						</td>
					</tr>
					<tr>
						<td>商品现价</td>
						<td>
							<input type="text" name="price" value="<?php echo ($row['price']); ?>" datatype="n" errormsg="必须为数字"  nullmsg="价格不能为空" sucmsg="填写正确"/>
						</td>
					</tr>
					<tr>
						<td>商品原价</td>
						<td>
							<input type="text" name="old_price" value="<?php echo ($row['old_price']); ?>" datatype="n" errormsg="必须为数字" nullmsg="价格不能为空" sucmsg="填写正确"/>
						</td>
					</tr>

					<tr>
						<td>商品图片展示</td>
						<td>
							<input type="file" name="goods_img">
						</td>
					</tr>
					<tr>
						<input type="hidden" name="old_img" value="<?php echo ($row['goods_img']); ?>">
						<td>原图</td>
						<td><img src="__PUBLIC__/Uploads/200x100_<?php echo ($row['goods_img']); ?>" alt=""></td>
					</tr>
					<tr>
						<td>商品服务</td>
						<td>
							<?php if(is_array($serverrows)): $i = 0; $__LIST__ = $serverrows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$serverrow): $mod = ($i % 2 );++$i; if(in_array($i,$goods_server)): ?><input type="checkbox" name="goods_server[]" value="<?php echo ($i); ?>" checked><?php echo ($serverrow); ?><br/>
							<?php else: ?>
								<input type="checkbox" name="goods_server[]" value="<?php echo ($i); ?>"><?php echo ($serverrow); ?><br/><?php endif; endforeach; endif; else: echo "" ;endif; ?>
							
						</td>
					</tr>
					<tr>
						<td>商品细节展示</td>
						<td>
							<!-- 加载编辑器的容器  -->
							<textarea style="width:520px;" name="detail" id="ueditor" >
								<?php echo ($row['detail']); ?>
							</textarea>
							
						</td>
					</tr>
					<input type="hidden" name="gid" value="<?php echo ($row['gid']); ?>">
					<tr>
						<td></td>
						<td><input type="submit" class='btn btn-primary' /></td>
					</tr>

				</tbody>
			</table>
		</form>
	</div>
</div>
<!-- Ueditor配置 开始-->
<!-- 配置文件 -->
<script type="text/javascript" src="__ROOT__/Public/Ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__ROOT__/Public/Ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
      window.UEDITOR_HOME_URL ="__ROOT__/Public/Ueditor/";//指出ueditor的存放路径
      window.onload=function(){
          UE.getEditor('ueditor');//要传入一个ID才能显示编辑器，即textarea中的id
      }
</script>
<!-- Ueditor配置 结束-->

		</div>
	</div>
	<script type="text/javascript">

	$(function(){

		
		//Validform.js表单验证初始化
		$(".registerform").Validform({
				tiptype:3
		});

		// 根据模块名称使相应的顶部导航变色，左侧菜单列表显示
		cls="<?php echo get_url_module();?>";//获取模块名方法，Admin\common\common.php中自定义方法
		$(".menuList ."+cls).css('background','#3B5A79').siblings('a').css('background','#4081C1');
		$(".box .leftMenu ."+cls).show().siblings('div').hide();
		// alert(cls);
	})
	</script>
</body>	

</html>